package com.ma.client;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;

import java.util.List;
import java.util.Map;

@FeignClient(name = "provider-service", path = "/api/products", fallback = ProductClientFallback.class)
public interface ProductClient {
    @GetMapping
    List<Map<String, Object>> list();

    @GetMapping("/{id}")
    Map<String, Object> detail(@PathVariable("id") Integer id);

    @GetMapping("/headers")
    Map<String, String> getHeaders(@RequestHeader Map<String, String> headers);

    @GetMapping("/hello")
    String hello();
}

